/*
*************************************************************************
本文件归属于西安协同时光软件有限公司，未经许可，不得擅自使用、拷贝和修改
*项目组:金堆城钼业股份有限公司科研项目管理信息系统项目组
*版 本: 1.0   
*日 期：Mar 1, 2010   
*时 间：11:22:53 AM   
*作 者： Administrator   
*************************************************************************   
*/  
package com.manager.commons.basemanage.commons;  

import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import org.apache.log4j.PropertyConfigurator;

import com.manager.BaseDao;
import com.manager.commons.BeanFactory;
import com.manager.commons.CommonUtil;
import com.manager.commons.basemanage.entity.BaseData;
import com.manager.commons.basemanage.entity.BaseDataList;
import com.manager.commons.config.ConfigFactory;
import com.manager.commons.config.Constants;
import com.manager.sms.SmsSend;
import com.manager.sms.SmsSend33d9Impl;
import com.util.SpringBeanFactory;

/**   
 * TODO 此处描写类的详细信息和功能   *   
 * @author  Administrator   
 * @since  jdk1.6   */
public class GetSelectBase extends HttpServlet {
	
	private BaseDao baseDao;

	public GetSelectBase() {
		super();
	}

	

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occurs
	 */
	public void init() throws ServletException {

		baseDao= (BaseDao) BeanFactory.getInstance().getBean("baseDao");
		BaseData bd=new BaseData();
		SelectStaticData selData=new SelectStaticData();
		BaseDataList bdList=new BaseDataList();
		List<BaseDataList> baseDataList=(List)baseDao.queryAll(bdList);
		List<BaseData> baseData=(List)baseDao.queryAll(bd);
		for(BaseData o:baseData){
			String p_id=o.getId().toString();
			List orderValue=new ArrayList();
			for(BaseDataList bo:baseDataList){
				String t_id=bo.getTId().toString();
				if(bo.getTId().toString().equals(p_id)){
					orderValue.add(bo);
				}
			}
			if(orderValue.size()>0){
				selData.put(o.getTypeName(), orderValue);
			}
		}
		SpringBeanFactory.getInstance();
		CommonUtil.SMS_OPEN = Integer.valueOf(ConfigFactory.getInstance().getConfig().getString(Constants.SYC_SYSTEM,Constants.SMS_OPEN));	
		
		if(CommonUtil.SMS_OPEN == 1){
			CommonUtil.smsSend = new SmsSend33d9Impl();
			CommonUtil.smsSend.start();
		}
		CommonUtil.ATTACHE_FILE = ConfigFactory.getInstance().getConfig().getString(Constants.SYC_SYSTEM,Constants.ATTACH_FILE);
		
	}

	public BaseDao getBaseDao() {
		return baseDao;
	}

	public void setBaseDao(BaseDao baseDao) {
		this.baseDao = baseDao;
	}

}
